package org.youyun56.gpsserver.command.console;

import java.util.List;

import org.apache.log4j.Logger;
import org.youyun56.gpsserver.command.GlobalProperties;

public class ConsoleCommand implements Command {
    private String style = null;
    private String regExp = null;
    private String description = null;
    private List<Executor> executors;
    private String input;
    private final static Logger log = Logger.getLogger(ConsoleCommand.class);

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub
        if (executors == null || executors.size() == 0) {
            log.fatal("NO EXECUTOR FOR COMMAND : " + input);
            return GlobalProperties.RESULT_FAILED;
        }
        return executors.get(0).execute(this).toString();
    }

    public String getStyle() {
        return style;
    }

    public void setStyle(String style) {
        this.style = style;
    }

    public String getRegExp() {
        return regExp;
    }

    public void setRegExp(String regExp) {
        this.regExp = regExp;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setExecutors(List<Executor> executors) {
        this.executors = executors;
    }

    public List<Executor> getExecutors() {
        // TODO Auto-generated method stub
        return executors;
    }

    public String getInput() {
        return input;
    }

    public void setInput(String input) {
        this.input = input;
    }

}
